<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <title>工作报告</title>
    <meta charset="utf-8">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <style type="text/css">
        [v-cloak] {
            display: none;
        }

        table {
            border-collapse: collapse;
            border-right: 1px solid #cbcbcd;
            /*border-bottom:1px solid #cbcbcd;*/
            margin-left: 0px;
            margin-top: 0px;
            margin-bottom: -1px !important;
            margin-right: 0px;
        }

        th, td {
            border-top: 1px solid #cbcbcd;
            border-left: 1px solid #cbcbcd;
            color: #333;
            font-weight: normal;
            line-height: 24px;
            padding-top: 4px !important;
            padding-bottom: 4px !important;
        }

        th {
            background-color: #F8F8F8;
        }

        .table-border-right-none {
            border-right-width: 0px;
        }

        table .td-title {
            background-color: #f8f8f8;
            line-height: 0.24rem;
            font-weight: normal;
        }

        table .td-title2 {
            line-height: 0.24rem;
            font-weight: bold;
        }

        table .td-module {
            background-color: #f8f8f8;
            line-height: 0.24rem;
            font-weight: normal;
        }

        /*娴sir写*/
        .table > tbody > tr > td.td-row2 {
            height: 1rem;
            line-height: 0.3rem;
            max-height: 1rem;
            overflow: hidden;
        }

        .table > tbody > tr > td.td-row2 span {
            max-height: 0.9rem;
            line-height: 0.3rem;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
        }

        .table > tbody > tr > td.td-row3 {
            height: 0.48rem;
            line-height: 0.2rem;
            max-height: 0.48rem;
            overflow: hidden;
        }

        .table > tbody > tr > td.td-row3 span {
            max-height: 0.6rem;
            line-height: 0.3rem;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
        }

        .td-value span.lineOne {
            max-height: 0.3rem;
            line-height: 0.3rem;
            overflow: hidden;
            text-overflow: ellipsis;
            /*display: -webkit-box;*/
            /*-webkit-box-orient: vertical;*/
            /*-webkit-line-clamp: 1;*/
        }

        input[type=text], input[type=tel], input[type=number], select {
            box-sizing: border-box;
            border-width: 0;
            border-style: none;
            padding-right: 0 !important;
            padding-top: 0 !important;
            padding-bottom: 0 !important;
            margin-left: 0 !important;
            margin-right: 0 !important;
            margin-top: 0 !important;
            margin-bottom: 0 !important;
            padding-left: 0.06rem;
        }

        input[type=text], input[type=tel], input[type=number], select {
            height: 0.24rem;
            width: 100%;
            border: none;
            outline: none;
            overflow: hidden;
            text-overflow: ellipsis;
            /*-webkit-appearance: none;*/
        }

        textarea {
            height: 0.56rem;
            width: 100%;
            border: none;
            outline: none;
            -webkit-appearance: none;
            resize: none;
            padding-top: 0.2rem;
            padding-left: 0.06rem;
        }

        .width90 {
            width: 0.96rem;
        }

        .width60 {
            width: 0.6rem;
        }

        .span-a-btn {
            position: absolute;
            right: 0.1rem;
        }

        .userbox {
            border: 0.01rem #BBBBBB solid;
            background-color: White;
            width: 99%;
            overflow: hidden;
        }

        div.userbox {
            min-height: 0.21rem;
            padding-left: 0.06rem;
            padding-top: 0.06rem;
            height: auto;
        }

        input.userbox {
            height: 0.21rem;
            padding-left: 0.06rem;
            line-height: 0.21rem;
        }

        .userbox input {
            border-width: 0;
            border-style: none;
            width: 2.8rem;
        }

        .user {
            height: 0.2rem;
            line-height: 0.2rem;
            max-height: 0.2rem;
            float: left;
            text-align: left;
            min-width: 0.32rem;
            padding-left: 0.01rem;
            overflow: hidden;
            cursor: pointer;
        }

        .user:hover {
            background-color: #cfd4d1;
        }

        .userbox .over.user {
            background-color: #cfd4d1;
        }

        .userbox .select.user {
            color: #fff;
            background-color: #045B9E;
        }

        .saveModle {
            width: 5rem;
            height: 3rem;
            position: fixed;
            top: 50%;
            left: 50%;
            margin-left: -2.5rem;
            margin-top: -1.5rem;
            background: #fff;
            border-radius: 0.1rem;
            z-index: 1978;
            display: none;
            border: 0.01rem solid #cfcfcf;
        }

        .saveModle .top {
            height: 0.34rem;
            line-height: 0.34rem;
            font-size: 0.14rem;
            font-weight: bold;
            color: #333;
            padding-left: 0.07rem;
            border-bottom: 1px solid #cfcfcf;
            background: #fff;
        }

        .saveModle .top .title {
            height: 0.32rem;
            line-height: 0.32rem;
            font-size: 0.14rem;
            font-weight: bold;
            color: #333;
            float: left;
            background: #fff;
        }

        .saveModle .top .btn {
            font-size: 0.2rem;
            width: 0.34rem;
            height: 0.22rem;
            line-height: 0.12rem;
            display: inline-block;
            float: right;
        }

        .saveModle .top .btn:hover {
            color: red;
        }

        .saveModle .saveBtn {
            margin: 0 auto;
            margin-top: 0.35rem;
            display: block;

        }

        .modleBj {
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            z-index: 1977;
            background: #DCE2F1;
            filter: alpha(opacity=60);
            opacity: .6;
            display: none;
        }

        #modal {
            height: 100%;
            width: 100%;
            position: absolute;
            z-index: 999;
            background-color: white;
        }

        .td-value {
            text-align: left !important;
            vertical-align: middle;
            word-wrap: break-word;
        }

        .td-value span {
            display: inline-block;
            max-height: 0.56rem;
            overflow: hidden;
            padding-left: 0.06rem;
            word-wrap: break-word;
            color: #2a8cec !important;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            background-color: #d3e8fd;
            padding: 0.08rem 0.06rem;
            border: 0.01rem solid #e8e8ea;
            display: none;
            overflow: hidden;
        }

        .div-td-content-more i {
            width: 0.15rem;
            height: 0.12rem;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 0.5rem;
            top: -.12rem;
        }

        .table-bordered tbody tr:last-child td {
            border-bottom-color: transparent !important;
        }

        .lastTable tbody tr:last-child td {
            border-bottom-color: #cbcbcd !important;
        }

        h5 {
            padding: 0;
            font-size: 12px;
            text-align: center;
            color: #333333;
        }

        td.bd_none {
            padding: 0 !important;
            border: 0 !important;
            border-width: 0 !important;
        }

        .jiaobiao {
            position: relative;
        }

        .jiaobiao i {
            display: block;
            width: 0;
            height: 0;
            border-width: 0px 0 .12rem .12rem;
            border-style: solid;
            border-color: transparent transparent transparent #2a8cec;
            position: absolute;
            top: 0px;
            left: 0px;
        }

        .tit {
            background-color: #f8f8f8;
            line-height: 0.24rem;
            height: 0.24rem;
            font-weight: bold;
        }

        .td-title1 {
            line-height: 0;
        }
        .td-value1{
            color: #2a8cec;
        }

        .btn-blue {
            border: none;
            background: #2a8ced;
            color: #fff;
            font-size: 0.22rem;
            height: 0.58rem;
            width: 14%;
        }

        .btn-blue.focus, .btn-blue:focus, .btn-blue:hover {
            color: #fff;
            text-decoration: none;
        }
    </style>

    <script src="/dist/js/pages/wreport/service.js?t=42e28def"></script>
    <script src="/dist/js/pages/wreport/Template.js?t=42e28def"></script>

</head>
<body style="background-color:#fff;">
<div class="div-td-content-more" style="width: 100%;"><i></i></div>
<section v-cloak class="content" id="app" style="padding: 0 0.04rem;">
    <table class="table text-center">
        <tr>
            <th style="width:25%" v-if="isHasModule('tomorrowAMPlan')" class="td-title1">次日上午安排</th>
            <td v-if="isHasModule('tomorrowAMPlan')" class="td-value1">
                <input v-if="pageType=='edit'" type="text" style="padding-right: 1000px"
                       v-model="report.tomorrowAMPlan.content"/>
                <span v-else class="td-value">{{report.tomorrowAMPlan.content}}</span>
            </td>
        </tr>
        <tr>
            <th v-if="isHasModule('tomorrowPMPlan')" class="td-title1">次日下午安排</th>
            <td v-if="isHasModule('tomorrowPMPlan')" class="td-value">
                <input v-if="pageType=='edit'" type="text" v-model="report.tomorrowPMPlan.content"/>
                <span v-else class="td-value">{{report.tomorrowPMPlan.content}}</span>
            </td>
        </tr>
        <tr>
            <th v-if="isHasModule('experience')" class="td-title1" style="width:25%">心得体会</th>
            <td v-if="isHasModule('experience')" class="td-value">
                <input v-if="pageType=='edit'" type="text" v-model="report.experience.content"
                       style="text-align: left !important;"/>
                <span v-else class="td-value">{{report.experience.content}}</span>
            </td>
        </tr>
        <tr v-if="isHasModule('forSupportMatters')" v-for="(matter,i) in report.forSupportMatters">
            <th rowspan="2" style="line-height: 0.24rem;" v-if="i==0" class="td-title">需要公司<br>支持的事项</th>
            <td class="td-value">
                <input v-if="pageType=='edit'" type="text" v-model="matter.trackContent"
                       style="text-align: left !important;">
                <span v-else class="td-value">{{matter.trackContent}}</span></td>
        </tr>
    </table>
    <table class="table text-center">
        <tr v-if="isHasModule('personSituation')">
            <th class="td-title1" style="width:25%">人员情况</th>
            <td class="td-value">
                <input v-if="pageType=='edit'" type="text"
                       v-model="report.personSituation.content" style="text-align: left !important;"/>
                <span v-else class="td-value">{{report.personSituation.content}}</span>
            </td>
        </tr>
        <tr v-if="isHasModule('tomorrowPlan')">
            <th class="td-title1" style="width:25%">第二天计划</th>
            <td class="td-value">
                <input v-if="pageType=='edit'" type="text" v-model="report.tomorrowPlan.content"
                       style="text-align: left !important;"/>
                <span v-else class="td-value">{{report.tomorrowPlan.content}}</span>
            </td>
        </tr>
        <tr v-if="isHasModule('troubleShooting')" v-for="(item,i) in report.troubleShooting">
            <th style="width:25%" rowspan="3" class="td-title" v-if="i==0">当天未处理的前三个疑难故障</th>
            <td class="td-value">
                <input v-if="pageType=='edit'" type="text" v-model="item.trackContent"/>
                <span v-else class="td-value">{{item.trackContent}}</span>
            </td>
        </tr>
    </table>
    <table class="table text-center" v-if="isHasModule('tomorrowVisitPlanRegion')">
        <tr>
            <th style="border-bottom: none;" class="tit">第二天拜访计划(区域)
                <span class="span-a-btn" v-if="pageType=='edit'">
                <a href="javascript:void(0);" class="a-btn"
                   @click="addRow('tomorrowVisitPlan2','TomorrowVisitPlan')">添加一行</a>
                <a href="javascript:void(0);" class="a-btn"
                   @click="delRow('tomorrowVisitPlan2')">删除一行</a>
                </span>
            </th>
        </tr>
        <tr>
            <td class="bd_none">
                <table class="table text-center table-border-right-none">
                    <tr>
                        <th style="width:25%" class="jiaobiao"><i></i>客户名称</th>

                        <th style="width:25%">拜访方式</th>
                        <th>客户地点</th>
                    </tr>
                    <tr v-for="(item,i) in report.tomorrowVisitPlan">

                        <td style="width:25%;text-align:center;" class="td-value1">
                            <input type="text" v-if="pageType=='edit'" v-model="item.customerName" v-line-inserted="i"
                                   class="txtParent" @click="onfocus1(i)">
                            <span v-else class="td-value" style="font-weight: normal;text-align: center;display:block;">{{item.customerName}}</span>
                        </td>
                        <td class="td-value1">
                            <select v-if="pageType=='edit'" v-model="item.visitMethod">
                                <option v-for="option in visitModelList" v-bind:value="option.value">
                                    {{option.text}}
                                </option>
                            </select>
                            <span v-else class="td-value" style="font-weight: normal;text-align: center;display:block;">{{item.visitMethod}}</span>
                        </td>
                        <td class="td-value1" style="word-break:break-all;overflow:hidden;max-height:0.24rem;">
                            <input type="text" v-if="pageType=='edit'" v-model="item.customerAddress">
                            <span v-else class="td-value" style="font-weight: normal;max-height:0.24rem;">{{item.customerAddress}}</span>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>

    </table>
    <table class="table text-center" v-if="isHasModule('workOnTodayDescs')">
        <tr>
            <th class="td-module">当日工作情况描述
                <span class="span-a-btn" v-if="pageType=='edit'">
                            <a href="javascript:void(0);" class="a-btn"
                               @click="addRow('workOnTodayDescs','WorkOnTodayDesc')">添加一行</a>
                        <a href="javascript:void(0);" class="a-btn"
                           @click="delRow('workOnTodayDescs')">删除一行</a>

                </span></th>
        </tr>
        <tr>
            <td class="bd_none">
                <table class="table text-center table-border-right-none" v-for="(work,i) in report.workOnTodayDescs">
                    <tr v-if="isHasModule('workOnTodayDescs')">
                        <td width="95%" class="td-value td-row2">
                            <textarea v-if="pageType=='edit'" v-model="work.content"></textarea>
                            <span v-else class="td-value">{{work.content}}</span>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table class="table text-center" v-if="isHasModule('todayCustomerVisit')">
        <tr>
            <th style="border-bottom: none;" class="tit">当日面访情况
                <span class="span-a-btn" v-if="pageType=='edit' && (roleName=='大客户经理')">
                            <a href="javascript:void(0);" class="a-btn"
                               @click="addRow('todayCustomerVisit','CustomerSaler')">添加一行</a>
                        <a href="javascript:void(0);" class="a-btn"
                           @click="delRow('todayCustomerVisit')">删除一行</a>
                </span>
            </th>
        </tr>
        <tr>
            <td class="bd_none">
                <table class="table  text-center table-border-right-none" v-for="(item,i) in report.todayCustomerVisit">
                    <tr>
                        <th style="width:25%" class="jiaobiao"><i></i>客户姓名</th>
                        <td style="width:25%" class="td-value1">
                            <input v-if="pageType=='edit'" type="text" v-model="item.name"/>
                            <span v-else class="td-value">{{item.name}}</span>
                        </td>
                        <th style="width:25%">客户电话</th>
                        <td class="td-value1" style="word-break:break-all;overflow:hidden;max-height:0.24rem;">
                            <input v-if="pageType=='edit'" @blur="findCusByTel(item)" type="text" v-model="item.tel"/>
                            <span v-else class="td-value">{{item.tel}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th>客户来源</th>
                        <td class="td-value1">
                            <select v-if="pageType=='edit'" v-model="item.source">
                                <option v-for="option in cusSource" v-bind:value="option.value">
                                    {{option.text}}
                                </option>
                            </select>
                            <span v-else class="td-value">{{item.source}}</span>
                        </td>
                        <th>陪同人员</th>
                        <td class="td-value1"><input v-if="pageType=='edit'" type="text" v-model="item.entourage"/>
                            <span v-else class="td-value">{{item.entourage}}</span></td>
                    </tr>
                    <tr>
                        <th>意向型号</th>
                        <td class="td-value1"><input v-if="pageType=='edit'" type="text" v-model="item.intentionModel"/>
                            <span v-else class="td-value">{{item.intentionModel}}</span></td>
                        <th>购买方式</th>
                        <td class="td-value1"><select v-if="pageType=='edit'" v-model="item.buyType">
                            <option v-for="option in buyTypeList" v-bind:value="option.value">
                                {{ option.text }}
                            </option>
                        </select>
                            <span v-else class="td-value">{{item.buyType}}</span></td>
                    </tr>
                    <tr>
                        <th>购买时间</th>
                        <td colspan="3" class="td-value1"><select v-if="pageType=='edit'" v-model="item.buyDate">
                            <option v-for="option in buyDateList" v-bind:value="option.value">
                                {{option.text}}
                            </option>
                        </select>
                            <span v-else class="td-value">{{item.buyDate}}</span></td>
                    </tr>
                    <tr>
                        <th>资金情况来源<br>(首付款金额)</th>
                        <td class="td-value td-row2" style="word-break: break-all;overflow: hidden;">
                            <input v-if="pageType=='edit'" type="text" v-model="item.fundCondition"/>
                            <span v-else class="td-value">{{item.fundCondition}}</span>
                        </td>
                        <th>已有设备<br>(设备类型)</th>
                        <td class="td-value td-row2" style="word-break: break-all;overflow: hidden;">
                            <input v-if="pageType=='edit'" type="text" v-model="item.existingDevice"/>
                            <span v-else class="td-value">{{item.existingDevice}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th>其他情况</th>
                        <td colspan="3" class="td-value td-row2" style="word-break: break-all;overflow: hidden;">
                            <input v-if="pageType=='edit'" type="text" v-model="item.otherCondition"/>
                            <span v-else class="td-value">{{item.otherCondition}}</span>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table class="table  table-bordered text-center" v-if="isHasModule('todayVisitCustomer')">
        <tr>
            <th style="border-bottom: none;" class="tit">当日拜访客户
                <span class="span-a-btn" v-if="pageType=='edit'">
                            <a href="javascript:void(0);" class="a-btn"
                               @click="addRow('todayVisitCustomer','CustomerSalerVisit')">添加电访客户</a>
                        <a href="javascript:void(0);" class="a-btn"
                           @click="delRow('todayVisitCustomer')">删除一行</a>
                </span>
            </th>
        </tr>

        <tr class="td-title2">
            <td colspan="4" style="padding: 0px !important;">
                <table class="table  text-center table-border-right-none" v-for="(item,i) in report.todayVisitCustomer">
                    <tr>
                        <th style="width:25%" class="jiaobiao"><i></i>客户电话</th>
                        <td style="width:25%" class="td-value1">
                            <input v-if="pageType=='edit'" @blur="findCusByTel(item)" type="text" v-model="item.tel"/>
                            <span v-else class="td-value">{{item.tel}}</span>
                        </td>
                        <th style="width:25%">客户来源</th>
                        <!--<td class="td-row2"><input type="text" v-model="item.source"/></td>-->
                        <td style="width:25%" class="td-value1">
                            <select v-if="pageType=='edit'" v-model="item.source">
                                <option v-for="option in cusSource" v-bind:value="option.value">
                                    {{option.text}}
                                </option>
                            </select>
                            <span v-else class="td-value">{{item.source}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th style="width:25%">姓名</th>
                        <td style="width:25%" class="td-value1">
                            <input v-if="pageType=='edit'" type="text" v-model="item.name"/>
                            <span v-else class="td-value">{{item.name}}</span>
                        </td>
                        <!--<td style="width: 60px;">客户生日</td>-->
                        <th style="width:25%" >拜访方式</th>
                        <td style="width:25%" class="td-value1">
                            <span class="td-value">{{item.visitMode}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th style="width:25%">陪同人员</th>
                        <td style="width:25%" class="td-value1">
                            <input v-if="pageType=='edit'" type="text" v-model="item.entourage"/>
                            <span v-else class="td-value">{{item.entourage}}</span>
                        </td>
                        <th style="width:25%">意向型号</th>
                        <td style="width:25%" class="td-value1">
                            <input v-if="pageType=='edit'" type="text" v-model="item.intentionModel"/>
                            <span v-else class="td-value">{{item.intentionModel}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th style="width:25%">购买方式</th>
                        <td style="width:25%" class="td-value1">
                            <select v-if="pageType=='edit'" v-model="item.buyType">
                                <option v-for="option in buyTypeList" v-bind:value="option.value">
                                    {{ option.text }}
                                </option>
                            </select>
                            <span v-else class="td-value">{{item.buyType}}</span>
                        </td>
                        <th style="width:25%">购买时间</th>
                        <td style="width:25%" class="td-value1">
                            <select v-if="pageType=='edit'" v-model="item.buyDate">
                                <option v-for="option in buyDateList" v-bind:value="option.value">
                                    {{option.text}}
                                </option>
                            </select>
                            <span v-else class="td-value">{{item.buyDate}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th>基本情况</th>

                        <!--<td class="td-row2 width60 td-value1">-->
                        <!--<input v-if="pageType=='edit'" type="text" v-model="item.birthDay"/>-->
                        <!--<span v-else>{{item.birthDay}}</span>-->
                        <!--</td>-->
                        <td class="td-value1" colspan="3">
                             <textarea v-if="pageType=='edit'"
                                       v-model="item.otherCondition"></textarea>
                            <span v-else class="td-value">{{item.otherCondition}}</span>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table class="table  table-bordered text-center" v-if="isHasModule('todayVisitCustomerBigRegion')">
        <tr>
            <th style="border-bottom: none;" class="tit">当日拜访客户</th>
        </tr>
        <tr class="td-title2">
            <td colspan="4" style="padding: 0px !important;">
                <table class="table  text-center table-border-right-none"
                       v-for="(item,i) in report.todayVisitCustomerBigRegion">
                    <tr>
                        <th style="width:25%" class="jiaobiao"><i></i>客户电话</th>
                        <td style="width:25%" class="td-value">
                            <span>{{item.tel}}</span>
                        </td>
                        <th style="width:25%" >客户来源</th>
                        <!--<td class="td-row2"><input type="text" v-model="item.source"/></td>-->
                        <td style="width:25%" class="td-value">
                            <span>{{item.source}}</span></td>
                    </tr>
                    <tr>
                        <th style="width:25%">姓名</th>
                        <td style="width:25%" class="td-value">
                            <span>{{item.name}}</span>
                        </td>
                        <!--<td style="width: 60px;">客户生日</td>-->
                        <th style="width:25%">拜访方式</th>
                        <td style="width:25%" class="td-value">

                            <span>{{item.visitMode}}</span>
                        </td>

                    </tr>
                    <tr>
                        <th style="width:25%">陪同人员</th>
                        <td style="width:25%" class="td-value">
                            <span>{{item.entourage}}</span>
                        </td>
                        <th style="width:25%">意向型号</th>
                        <td style="width:25%" class="td-value">
                            <span>{{item.intentionModel}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th style="width:25%" >购买方式</th>
                        <td style="width:25%" class="td-value">
                            <span>{{item.buyType}}</span>
                        </td>
                        <th style="width:25%" >购买时间</th>
                        <td style="width:25%" class="td-value">
                            <span>{{item.buyDate}}</span>
                        </td>
                    </tr>

                    <tr>
                        <th >基本情况</th>

                        <!--<td class="td-row2 width60 td-value1">-->
                        <!--<input v-if="pageType=='edit'" type="text" v-model="item.birthDay"/>-->
                        <!--<span v-else>{{item.birthDay}}</span>-->
                        <!--</td>-->
                        <td class="td-value" colspan="3">
                            <span>{{item.otherCondition}}</span>
                        </td>

                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table class="table text-center" v-if="isHasModule('todayCustomerTelVisit')">
        <tr>
            <th style="border-bottom: none;" class="tit">当日电访情况
                <span class="span-a-btn" v-if="pageType=='edit'">
                            <a href="javascript:void(0);" class="a-btn"
                               @click="addRow('todayCustomerTelVisit','CustomerSaler')">添加一行</a>
                        <a href="javascript:void(0);" class="a-btn"
                           @click="delRow('todayCustomerTelVisit')">删除一行</a>
                        </span>
            </th>
        </tr>
        <tr>
            <td class="bd_none">
                <table class="table  text-center table-border-right-none"
                       v-for="(item,i) in report.todayCustomerTelVisit">
                    <tr>
                        <th style="width:25%" class="jiaobiao"><i></i>客户姓名</th>
                        <td style="width:25%" class="td-value"><input v-if="pageType=='edit'" type="text"
                                                                      v-model="item.name"/>
                            <span v-else>{{item.name}}</span></span>
                        </td>
                        <th style="width:25%">客户电话</th>
                        <td class="td-value"><input v-if="pageType=='edit'" @blur="findCusByTel(item)" type="text"
                                                    v-model="item.tel"/>
                            <span v-else>{{item.tel}}</span></td>
                    </tr>
                    <tr>
                        <th>客户来源</th>
                        <td class="td-value"><select v-if="pageType=='edit'" v-model="item.source">
                            <option v-for="option in cusSource" v-bind:value="option.value">
                                {{option.text}}
                            </option>
                        </select>
                            <span v-else>{{item.source}}</span></td>
                        <th>购买时间</th>
                        <td class="td-value"><select v-if="pageType=='edit'" v-model="item.buyDate">
                            <option v-for="option in buyDateList" v-bind:value="option.value">
                                {{option.text}}
                            </option>
                        </select>
                            <span v-else>{{item.buyDate}}</span></td>
                    </tr>
                    <tr>
                        <th>意向型号</th>
                        <td class="td-value"><input v-if="pageType=='edit'" type="text" v-model="item.intentionModel"/>
                            <span v-else>{{item.intentionModel}}</span></td>
                        <th>购买方式</th>
                        <td class="td-value"><select v-if="pageType=='edit'" v-model="item.buyType">
                            <option v-for="option in buyTypeList" v-bind:value="option.value">
                                {{ option.text }}
                            </option>
                        </select>
                            <span v-else>{{item.buyType}}</span></td>
                    </tr>
                    <tr>
                        <th>资金情况来源<br>(首付款金额)</th>
                        <td class="td-value td-row2" style="word-break: break-all;overflow: hidden;">
                            <input v-if="pageType=='edit'" type="text" v-model="item.fundCondition"/>
                            <span v-else>{{item.fundCondition}}</span>
                        </td>
                        <th>已有设备<br>(设备类型)</th>
                        <td class="td-value td-row2" style="word-break: break-all;overflow: hidden;">
                            <input v-if="pageType=='edit'" type="text" v-model="item.existingDevice"/>
                            <span v-else>{{item.existingDevice}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th>其他情况</th>
                        <td colspan="3" class="td-value td-row2" style="word-break: break-all;overflow: hidden;">
                            <input v-if="pageType=='edit'" type="text" v-model="item.otherCondition"/>
                            <span v-else>{{item.otherCondition}}</span>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>


    <table class="table text-center">
        <tr v-if="isHasModule('visitLetterReason')">
            <th style="width:25%;">未达到拜<br>访量原因</th>
            <td class="td-value td-row2">    <textarea v-if="pageType=='edit'"
                                                       v-model="report.visitLetterReason.content"></textarea>
                <span v-else>{{report.visitLetterReason.content}}</span></td>
        </tr>
        <tr v-if="isHasModule('todayKnowVieSituation')">
            <th>当天知道<br>丢单情况</th>
            <td class="td-value td-row2">
                <input type="radio" name="todayKnowVieSituation" value="1"
                       v-model="report.todayKnowVieSituation.vieFlag"/>有竞争丢单
                <input type="radio" name="todayKnowVieSituation" value="0"
                       v-model="report.todayKnowVieSituation.vieFlag"/>无竞争丢单
            </td>
        </tr>
        <tr v-if="isHasModule('todayKnowVieSituation')">
            <th>具体情况</th>
            <td class="td-value td-row2">
                  <textarea v-if="pageType=='edit'"
                            v-model="report.todayKnowVieSituation.remark"></textarea>
                <span v-else>{{report.todayKnowVieSituation.remark}}</span>
            </td>
        </tr>
    </table>
    <table class="table text-center" v-if="isHasModule('tomorrowVisitPlan')">
        <tr>
            <th style="border-bottom: none;" class="tit">第二天拜访计划(大客户)
                <span class="span-a-btn" v-if="pageType=='edit'">
                <a href="javascript:void(0);" class="a-btn"
                   @click="addRow('tomorrowVisitPlan','TomorrowVisitPlan')">添加一行</a>
                <a href="javascript:void(0);" class="a-btn"
                   @click="delRow('tomorrowVisitPlan')">删除一行</a>
                </span>
            </th>
        </tr>
        <tr>
            <td class="bd_none">
                <table class="table  text-center table-border-right-none" v-for="(item,i) in report.tomorrowVisitPlan">
                    <tr>
                        <th style="width:25%" class="jiaobiao"><i></i>客户名称</th>
                        <td style="width:25%" class="td-value1">
                            <input type="text" v-if="pageType=='edit'" v-model="item.customerName" v-line-inserted="i"
                                   class="txtParent" @click="onfocus1(i)">
                            <span v-else class="td-value" style="text-align: center !important;">{{item.customerName}}</span>
                        </td>
                        <th style="width:25%">上次拜访时间</th>
                        <td class="td-value1" style="word-break:break-all;overflow:hidden;max-height:0.24rem;">
                            <input type="text" v-if="pageType=='edit'" v-model="item.lastVisitTime"
                                   @focus="showDatePicker($event,item)">
                            <span class="td-value" v-else>{{item.lastVisitTime}}</span>
                        </td>
                    </tr>
                    <tr>
                        <th>客户地点</th>
                        <td class="td-value1">
                            <input type="text" v-if="pageType=='edit'" v-model="item.customerAddress">
                            <span class="td-value" v-else>{{item.customerAddress}}</span>
                        </td>
                        <th style="border-bottom: 1px solid #cbcbcd;">客户行业</th>
                        <td class="td-value1">
                        <input type="text" v-if="pageType=='edit'" v-model="item.customerIndustry">
                        <span v-else class="td-value">{{item.customerIndustry}}</span></td>
                    </tr>
                    <tr>
                        <th>意向设备</th>
                        <td class="td-value1" colspan="3"><input type="text" v-if="pageType=='edit'" v-model="item.intentionDevice">
                            <span v-else class="td-value">{{item.intentionDevice}}</span></td>
                    </tr>
                    <tr>
                        <th>备注</th>
                        <td colspan="3" class="td-value1"><input type="text" v-if="pageType=='edit'"
                                                                v-model="item.remake">
                            <span v-else class="td-value">{{item.remake}}</span></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>

    <table class="table text-center" v-if="isHasModule('unfinishes')">
        <tr>
            <th class="tit">未关闭事项跟踪
                <span class="span-a-btn" v-if="pageType=='edit'"><a href="javascript:void(0);"
                                                                    class="a-btn"
                                                                    @click="addRow('unfinishes','Unfinish')">添加一行</a>
                            <a href="javascript:void(0);" class="a-btn"
                               @click="delRow('unfinishes')">删除一行</a>


                        </span></th>
        </tr>
        <tr>
            <td class="bd_none">
                <table class="table text-center table-border-right-none" v-for="(item,i) in report.unfinishes">
                    <tr>
                        <th style="width:25%" class="td-title1 jiaobiao"><i></i>工作内容</th>
                        <td class="td-value1"><textarea v-if="pageType=='edit'" v-model="item.trackContent"></textarea>
                            <span v-else class="td-value" style="text-align: left">{{item.trackContent}}</span></td>
                    </tr>
                    <tr>
                        <th class="td-title1">进展情况</th>
                        <td class="td-value1"><textarea v-if="pageType=='edit'" v-model="item.jinzhan"></textarea>
                            <span v-else class="td-value" style="text-align: left">{{item.jinzhan}}</span></td>
                    </tr>
                    <tr>
                        <th class="td-title1">预计关闭时间</th>
                        <td class="td-value1"> <textarea v-if="pageType=='edit'" v-model="item.overTime"
                                                        @focus="showDatePicker($event,item)"></textarea>
                            <span v-else class="td-value" style="text-align: left">{{item.overTime}}</span></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table class="table text-center" v-if="isHasModule('todayGatherSituation')">
        <tr>
            <th class="tit" colspan="4">当天收款情况
                <span class="span-a-btn" v-if="pageType=='edit'">
                            <a href="javascript:void(0);" class="a-btn"
                               @click="addRow('todayGatherSituation','Gather')">添加一行</a>
                        <a href="javascript:void(0);" class="a-btn"
                           @click="delRow('todayGatherSituation')">删除一行</a>
                        </span></th>
        </tr>
        <tr>
            <td class="bd_none">
                <table class="table  text-center" v-for="(item,i) in report.todayGatherSituation">
                    <tr class="td-title2">
                        <th style="width:25%" class="jiaobiao"><i></i>客户名称</th>
                        <td style="width:25%" class="td-value1"><input v-if="pageType=='edit'" type="text"
                                                                      v-model="item.customerName"/>
                            <span v-else class="td-value">{{item.customerName}}</span></td>
                        <th style="width:25%">收款性质</th>
                        <td class="td-value1"><select v-if="pageType=='edit'" v-model="item.gatherType">
                            <option v-for="option in gathering" v-bind:value="option.value">
                                {{option.text}}
                            </option>
                        </select>
                            <span v-else class="td-value">{{item.gatherType}}</span></td>
                    </tr>
                    <tr class="td-title2">
                        <th>收款金额</th>
                        <td class="td-value1"><input v-if="pageType=='edit'" type="number" v-model="item.money"/>
                            <span v-else class="td-value">{{item.money}}</span></td>
                        <th>打款银行</th>
                        <td class="td-value1"><input v-if="pageType=='edit'" type="text" v-model="item.bank"/>
                            <span v-else class="td-value">{{item.bank}}</span></td>
                    </tr>
                    <tr class="td-title2">
                        <th td-title2>收款情况<br>说明</th>
                        <td colspan="3" class="td-value1"><input v-if="pageType=='edit'" type="text"
                                                                v-model="item.remark"
                                                                style="text-align: left !important;border-bottom-color: black"/>
                            <span v-else class="td-value">{{item.remark}}</span></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <table class="table text-center" v-if="isHasModule('todayCostDetail')">
        <tr>
            <th class="tit" colspan="4">当日费用明细
                <span class="span-a-btn" v-if="pageType=='edit'">
                            <a href="javascript:void(0);" class="a-btn"
                               @click="addRow('todayCostDetail2','Cost')">添加一行</a>
                        <a href="javascript:void(0);" class="a-btn"
                           @click="delRow('todayCostDetail2')">删除一行</a>
                        </span>
            </th>
        </tr>
        <tr>
            <td class="bd_none">
                <table class="table text-center" v-for="(item,i) in report.todayCostDetail">
                    <tr class="td-title2">
                        <th style="width:25%" class="jiaobiao"><i></i>费用名称</th>
                        <td colspan="5" style="text-align: left;padding-left: 0.1rem;" class="td-value">
                            <span style="font-weight: normal">{{item.costBigName}}</span>
                            <span style="font-weight: normal">{{item.costSmallName}}</span>
                            <input type="button"
                                   style="float: right;width: 40px;height: 20px;padding-left: 6px;padding-right: 6px;padding-bottom: 0px;padding-top: 0px;"
                                   class="btn btn-blue" @click="gotoDetail(item)" value="查看"/>
                        </td>
                    </tr>
                    <tr>
                        <th style="width:25%">金额</th>
                        <td style="width:25%" class="td-value"><span>{{item.money}}</span></td>
                        <th style="width:25%">有无发票</th>
                        <td class="td-value">
                            <span v-if="item.invoiceFlag=='1'">有</span>
                            <span v-else>无</span>
                        </td>
                        <th style="width:25%">状态</th>
                        <td class="td-value">
                            <span v-if="item.auditFlag=='0'">审核中</span>
                            <span v-if="item.auditFlag=='1'">审核通过</span>
                            <span v-if="item.auditFlag=='2'">驳回</span>
                        </td>
                    </tr>
                    <tr>
                        <th>说明</th>
                        <td colspan="5" class="td-value td-row2">
                            <span>{{item.remark}}</span>
                        </td>
                    </tr>
                </table>
                <table class="table text-center" v-for="(item,i) in report.todayCostDetail2">
                    <tr class="td-title2">
                        <th style="width:25%" class="jiaobiao"><i></i>费用名称</th>
                        <td class="width90 td-value1" colspan="2">
                            <select v-if="pageType=='edit'" v-model="item.costBigId" style=" padding-left: 19px;"
                                    @change="getExpenseChildName(item)">
                                <option v-for="option in costBigNameList" v-bind:value="option.id">
                                    {{option.name}}
                                </option>
                            </select>
                            <span v-else class="td-value">{{item.costBigName}}</span>
                        </td>
                        <td class="width90 td-value1" colspan="3">
                            <select v-if="pageType=='edit'" v-model="item.costSmallId" style=" padding-left: 25px;"
                                    @change="getExpenseSmallName(item)">
                                <option v-for="option in item.costSmallNameList" v-bind:value="option.id">
                                    {{option.name}}
                                </option>
                            </select>
                            <span v-else class="td-value">{{item.costSmallName}}</span>
                        </td>

                    </tr>
                    <tr>
                        <th style="width:25%">金额</th>
                        <td style="width:15%" class="td-value1">
                            <input v-if="pageType=='edit'" type="number" style="text-align: center"
                                   v-model="item.money"/>
                            <span v-else class="td-value">{{item.money}}</span>
                        </td>
                        <th style="width:17%">有无发票</th>
                        <td class="td-value1">
                            <select v-if="pageType=='edit'" v-model="item.invoiceFlag" class="haveInvoice">
                                <option v-for="option in invoiceFlagList" v-bind:value="option.value">
                                    {{ option.text }}
                                </option>
                            </select>
                            <span v-else class="td-value">{{getInvoiceFlagName(item.invoiceFlag)}}</span>
                        </td>
                        <th style="width:15%">状态</th>
                        <td style="width:15%" class="td-value">
                            <span v-if="item.auditFlag=='0'">审核中</span>
                            <span v-if="item.auditFlag=='1'">审核通过</span>
                            <span v-if="item.auditFlag=='2'">驳回</span>
                        </td>
                    </tr>
                    <tr>
                        <th>说明</th>
                        <td colspan="5" class="td-value td-row2">
                            <input v-if="pageType=='edit'" type="text" v-model="item.remark"
                                   style="text-align: left !important;"/>
                            <span class="lineOne" v-else>{{item.remark}}</span>
                        </td>
                    </tr>

                </table>
            </td>
        </tr>
    </table>
    <div style="text-align:center;padding: 10px 0" class="div-btn">
        <input type="button" v-if="pageType=='edit' && report.main.flage == '-1' "
               class="btn oaBtn btn-xs"
               style="width:100px;margin-top: -4px;"
               value="保存草稿"
                @click="saveTraft"/>
        <input v-if="pageType=='edit'&&editable=='true'" type="button" style="width:100px;margin-top: -4px;"
               value="发送"
               class="btn oaBtn btn-xs" @click="OpenModle"/>
        <span v-if="pageType=='edit'&&editable!='true'" style="color:red;font-size:12px;">注：16:45前只能保存草稿</span>
    </div>
    <div class="saveModle" style="height: 280px">
        <div class="top">
            <div class="title">选择人员</div>
            <div class="btn" v-on:click="closeModle"> x</div>
        </div>
        <div id="header" class="header box-body" style="padding: 25px 20px;padding-bottom: 0;">

            <div class="form-group">
                <label id="aReceivers" tabindex="-1">收件人</label>
                <div class="userbox form-control" id="receivers"
                     v-on:click.stop="inputFocus('txtReceiver')">
                    <div v-for="(user,i) in report.receivers" class="user"
                         v-bind:class="{ select:receiverSelectedIdx==i }"
                         v-on:click="selectUser(i,'receiverSelectedIdx')">{{user.userName}};
                    </div>
                    <input type="text" id="txtReceiver"
                           @keyup.delete="deleteUser('receivers','receiverSelectedIdx',$event)"/>
                </div>
            </div>
            <div class="form-group">
                <label for="txtCopier" id="aCopiers" tabindex="-1">抄送人</label>
                <div class="userbox form-control" id="copiers"
                     v-on:click.stop="inputFocus('txtCopier')">
                    <div v-for="(user,i) in report.copiers" class="user"
                         v-bind:class="{ select: copierSelectedIdx == i }"
                         v-on:click="selectUser(i,'copierSelectedIdx')">{{user.userName}};
                    </div>
                    <input type="text" id="txtCopier"
                           @keyup.delete="deleteUser('copiers','copierSelectedIdx',$event)"/>
                </div>
            </div>
        </div>
        <input type="button" value="发送" class="saveBtn btn oaBtn" @click="saveGo">
    </div>
    <div class="modleBj"></div>
</section>
<!--rem.js-->
<script src="/dist/js/pages/rem/rem.js"></script>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<script src="/dist/js/oaApp.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=602456c3"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=666bff22"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $(function () {
        $("body").on("click", ".td-value", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });

</script>
<script type="text/javascript">
    function getUrlParamObj() {
        var args = new Object();
        var query = location.href;
        var pairs = query.split("&"); //www.cxybl.com break at ampersand
        for (var i = 0; i < pairs.length; i++) {
            var pos = pairs[i].indexOf('='); // look for "name=value"
            if (pos == -1) continue; // if not found, skip
            var argname = pairs[i].substring(0, pos); // extract the name
            var pos1 = argname.indexOf('?');
            if (pos1 > -1) {
                argname = argname.substring(pos1 + 1);
            }
            var value = pairs[i].substring(pos + 1); // extract the value
            value = decodeURIComponent(value); // decode it, if needed
            args[argname] = value; // store as a property
        }
        var ss = args.valueOf(0);
        obj = args;
        return args;
    }
    var app = new Vue({
        el: '#app',
        data: {
            pageType: getUrlParamObj().pageType,//如果pageType=edit说明是编辑页面，如果pagetype=browser，说明是查看页面
            editable: getUrlParamObj().editable,
            dateReissueEnd: getUrlParamObj().dateReissueEnd,
            roleName: getUrlParamObj().roleName,
            cusSource: [
                {text: '销售录入', value: '销售录入'},
                {text: '易企秀', value: '易企秀'},
                {text: '400', value: '400'},
                {text: '其他', value: '其他'}
            ],
            gathering: [
                {text: '银行欠款', value: '银行欠款'},
                {text: '配件欠款', value: '配件欠款'},
                {text: '首付垫款', value: '首付垫款'},
                {text: '以租代售租金', value: '以租代售租金'},
                {text: '服务费', value: '服务费'},
                {text: '银行垫款', value: '银行垫款'},
                {text: '以租代售的定金', value: '以租代售的定金'},
                {text: '其他', value: '其他'}
            ],
            costBigNameList: [],
            inferiorNameList: [],
            templates: [],
            currentUserTel: '',
            buyDateList: [
                {text: '一周内', value: '一周内'},
                {text: '一月内', value: '一月内'},
                {text: '一月以上', value: '一月以上'}
            ],
            buyTypeList: [
                {text: '全款', value: '全款'},
                {text: '内部分期', value: '内部分期'},
                {text: '融资', value: '融资'}
            ],
            visitModelList: [
                {text: '1', value: '1'},
                {text: '0', value: '0'}
            ],
            invoiceFlagList: [
                {text: '无', value: '0'},
                {text: '有', value: '1'}
            ],
            report: {
                tomorrowVisitPlan: [],
                weekPlan: [],
                receivers: [],
                copiers: [],
                main: {
                    id: '0',
                    title: '',
                    reportDate: this.reportDate,
                    userId: '',
                    moduleENames: "",
                    flage: '-1',
                    draft: 0
                },
                experience: {content: '', type: 1},//心得体会
                tomorrowAMPlan: {content: '', type: 6},//次日上午计划
                tomorrowPMPlan: {content: '', type: 7},//次日下午计划
                tomorrowPlan: {content: '', type: 3},//第二天计划
                personSituation: {content: '', type: 2},//人员情况
                troubleShooting: [//未处理前三个疑难故障
                    new Template.Unfinish('1'),
                    new Template.Unfinish('1'),
                    new Template.Unfinish('1')
                ],
                visitLetterReason: {content: '', type: 9},//未达到拜访量原因
                todayKnowVieSituation: {id: '', wId: '', vieFlag: '', remark: ''},//丢单原因
                forSupportMatters: [//需要公司支持的事项
                    new Template.Unfinish('2')
                ],
                workOnTodayDescs: [//当日工作情况描述
                    new Template.WorkOnTodayDesc()
                ],
                unfinishes: [//未关闭事项
                    new Template.Unfinish('3')
                ],
                todayCustomerVisit: [//当日拜访情况(面访)
                    new Template.CustomerSaler()
                ],
                todayCustomerTelVisit: [//当日拜访情况(电访)
                    new Template.CustomerSalerTel()
                ],
                todayVisitCustomerBigRegion: [//当日拜访情况(大区拜访)
                    new Template.CustomerSalerVisitRegion()
                ],
                todayCustomerTelVisit: [//当日拜访情况(电访)
                    new Template.CustomerSalerTel()
                ],
                todayCostDetail: [//当日通过的临时费用
                    new Template.Cost()
                ],
                todayCostDetail2: [//当日费用明细
                    new Template.Cost()
                ],
                jobDescriptionForBranch: [//下属工作情况-大区经理
                    new Template.Branch()
                ],
                todayGatherSituation: [//当天收款情况
                    new Template.Gather()
                ]
            },
            receiverSelectedIdx: -1,
            copierSelectedIdx: -1
        },
        methods: {
            getInvoiceFlagName: function (invoiceFlag) {
                var name = "";
                for (var i = 0; i < this.invoiceFlagList.length; i++) {
                    if (invoiceFlag == this.invoiceFlagList[i].value) {
                        name = this.invoiceFlagList[i].text;
                        break;
                    }
                }
                return name;
            },
            inputFocus: function (id) {
                $("#" + id).focus();
            },
            selectUser: function (i, prop) {
                this.receiverSelectedIdx = -1;
                this.copierSelectedIdx = -1;
                this[prop] = i;
            },
            unselectUser: function () {
                this.receiverSelectedIdx = -1;
                this.copierSelectedIdx = -1;
            },
            deleteUser: function (prop, idx, event) {
                if (event.keyCode == 46 || event.keyCode == 8 && event.target.value == "") {
                    if (this[idx] > -1) {
                        this.report[prop].splice(this[idx], 1);
                        this.receiverSelectedIdx = -1;
                        this.copierSelectedIdx = -1;
                    } else {
                        this[idx] = this.report[prop].length - 1;
                    }
                }
            },
            findCusByTel: function (customer) {
                var that = this;
                $.ajax({
                    url: server.ip + "/wreport/getCustomerByTel.json",
                    data: JSON.stringify({tel: customer.tel}),
                    success: function (r) {
                        if (!r.e.code && r.data.sendData) {
                            var data = r.data.sendData;
                            for (var p in data) {
                                customer[p] = data[p];
                            }
                        }
                    }
                });
            },
            getAllTemplates: function () {
                var that = this;
                $.ajax({
                    url: server.ip + "/template/getTreeNodes.json",
                    data: JSON.stringify({}),
                    success: function (templates) {
                        that.templates = [];
                        for (var i = 0; i < templates.length; i++) {
                            if (templates[i].id != "0") {
                                that.templates.push(templates[i]);
                            }
                        }
                    }
                });
            },
            getModulesByTemplateId: function (templateId) {
                var that = this;
                var arrModules = new Array();
                $.ajax({
                    url: server.ip + "/template2Module/getByTemplateId.json",
                    data: JSON.stringify({templateId: templateId}),
                    success: function (t2m) {
                        for (var i = 0; i < t2m.length; i++) {
                            $.wyui.postMethod(urlConfig.wreport.config.module.getById, {id: t2m[i].moduleId}, function (module) {
                                arrModules.push(module.eName);
                            }, true);
                        }
                        that.report.main.moduleENames = arrModules.join(',');
                    }
                });
            },
            gotoDetail: function (item) {
                var data = {
                    id: item.id,
                    type: item.costSmallName,
                    clickType: "cost"
                }
                prompt(JSON.stringify(data))
            },
            isHasModule: function (moduleEName) {
                var arrModuleENames = this.report.main.moduleENames.split(',');
                return $.inArray(moduleEName, arrModuleENames) > -1;
            },
            addRow: function (prop, template) {
                if (prop == "forSupportMatters") {
                    this.report[prop].push(new Template.Unfinish('2'));
                } else if (prop == "unfinishes") {
                    this.report[prop].push(new Template.Unfinish('3'));
                } else if (prop == "tomorrowVisitPlan2") {
                    this.report.tomorrowVisitPlan.push(new Template[template]());

                } else {
                    this.report[prop].push(new Template[template]());
                }
            },
            delRow: function (prop) {
                if (prop == "tomorrowVisitPlan2") {
                    this.report.tomorrowVisitPlan.splice(this.report.tomorrowVisitPlan.length - 1, 1);
                } else {
                    this.report[prop].splice(this.report[prop].length - 1, 1);
                }


            },
            showDatePicker: function (e, item) {
                WdatePicker({
                    onpicked: function (dp) {
                        item.overTime = dp.cal.getNewDateStr();
                        item.lastVisitTime = dp.cal.getNewDateStr();
                        return true;
                    }
                });
                $(e.target).blur();
            },
            getCityList: function (customer) {
                var that = this;
                service.getRegionByParentId({parentId: customer.buildProvinceId}, function (data) {
                    customer.cityList = data;
                });
            },
            getCountyList: function (customer) {
                var that = this;
                service.getRegionByParentId({parentId: customer.buildCityId}, function (data) {
                    customer.countyList = data;
                });
            },
            getExpenseChildName: function (cost) {
                var that = this;
                for (var i = 0; i < this.costBigNameList.length; i++) {
                    if (this.costBigNameList[i].id == cost.costBigId) {
                        cost.costBigName = this.costBigNameList[i].name;
                    }
                }
                service.getExpensesByParentId({
                    parentId: cost.costBigId,
                    userId: getUrlParamObj().userId
                }, function (data) {
                    cost.costSmallNameList = data;
                });
            },
            getExpenseSmallName: function (COST) {
                var that = this;
                for (var i = 0; i < COST.costSmallNameList.length; i++) {
                    if (COST.costSmallNameList[i].id == COST.costSmallId) {
                        COST.costSmallName = COST.costSmallNameList[i].name;
                    }
                }
            },
            closeModle: function () {
                $(".modleBj").hide();
                $(".saveModle").hide();
            },
            OpenModle: function () {
                if (getUrlParamObj().roleName == "区域经理") {
                    for (var i = 0; i < this.report.tomorrowVisitPlan.length; i++) {
                        if (this.report.tomorrowVisitPlan[i].customerName != "" || this.report.tomorrowVisitPlan[i].customerAddress != "" || this.report.tomorrowVisitPlan[i].visitMethod) {
                            if (this.report.tomorrowVisitPlan[i].customerName == "") {
                                alert("请填写客户名称！");
                                return false;
                            }
                            if (this.report.tomorrowVisitPlan[i].customerAddress == "") {
                                alert("请填写客户地点！");
                                return false;
                            }
                            if (!this.report.tomorrowVisitPlan[i].visitMethod) {
                                alert("请选择拜访方式！");
                                return false;
                            }
                        }
                    }
                }
                if (getUrlParamObj().roleName == "大客户经理") {
                    for (var i = 0; i < this.report.tomorrowVisitPlan.length; i++) {
                        if (this.report.tomorrowVisitPlan[i].customerName != "" || this.report.tomorrowVisitPlan[i].customerAddress != "" || this.report.tomorrowVisitPlan[i].lastVisitTime != "" || this.report.tomorrowVisitPlan[i].customerIndustry != "" || this.report.tomorrowVisitPlan[i].intentionDevice != "") {
                            if (this.report.tomorrowVisitPlan[i].customerName == "") {
                                alert("请填写客户名称！");
                                return false;
                            }
                            if (this.report.tomorrowVisitPlan[i].customerAddress == "") {
                                alert("请填写客户地点！");
                                return false;
                            }

                            if (this.report.tomorrowVisitPlan[i].customerIndustry == "") {
                                alert("请填写客户行业！");
                                return false;
                            }
                            if (this.report.tomorrowVisitPlan[i].intentionDevice == "") {
                                alert("请填写意向设备！");
                                return false;
                            }
                        }
                    }
                }
                //if是销售人员
                if (getUrlParamObj().roleName == "区域经理" || getUrlParamObj().roleName == "大区经理") {
//                    for(var i=0;i<this.report.todayCustomerVisit.length;i++){
//                        var data=this.report.todayCustomerVisit[i];
//                        if(data.tel!=""&&data.entourage==""||data.tel!=""&&data.visitMode==""){
//                            alert("当日拜访情况中 拜访方式 陪同人员 为必填项！");
//                            return false;
//                        }
//                    }
//                    for(var i=0;i<this.report.todayCustomerTelVisit.length;i++){
//                        var data=this.report.todayCustomerTelVisit[i];
//                        if(data.tel!=""&&data.entourage==""||data.tel!=""&&data.visitMode==""){
//                            alert("当日拜访情况中 拜访方式 陪同人员 为必填项！");
//                            return false;
//                        }
//                    }
                }
                $(".modleBj").show();
                $(".saveModle").show();
            },
            removeNull: function () {
                var list = this.report;
                for (var i = list.workOnTodayDescs.length - 1; i >= 0; i--) {
                    if (list.workOnTodayDescs[i].content == "") {
                        list.workOnTodayDescs.splice(i, 1);
                    }
                }
                for (var i = list.todayCostDetail.length - 1; i >= 0; i--) {
                    if (list.todayCostDetail[i].money == "") {
                        list.todayCostDetail.splice(i, 1);
                    }
                }
                for (var i = list.unfinishes.length - 1; i >= 0; i--) {
                    if (list.unfinishes [i].trackContent == "") {
                        list.unfinishes.splice(i, 1);
                    }
                }
                return list;
            },
            onfocus1: function (i) {
                var that = this;
                that.currentfocus = i;
            },
            saveGo: function () {
                var that = this;
                this.report.main.flage = "0";
                console.log(this.report.receivers)
                if (this.report.receivers.length === 0) {
                    alert("请填写收件人！");
                    return false;
                }
                var obj = {
                    dialog:'show'
                }
                prompt(JSON.stringify(obj))
                service.save(trimRN(this.removeNull()), function (r) {
                    if (!r.e.code) {
                        var pageId = top.getActivePageId();
                        console.log(pageId)
                        alert("发送成功")
                        var obj = {
                            dialog:'success'
                        }
                        prompt(JSON.stringify(obj))
                    } else {
                        alert(r.e.desc);
                    }
                });
            },
            saveTraft: function () {
                var that = this
                this.report.main.flage = "-1";
                if (getUrlParamObj().roleName == "区域经理") {
                    for (var i = 0; i < this.report.tomorrowVisitPlan.length; i++) {
                        if (this.report.tomorrowVisitPlan[i].customerName != "" || this.report.tomorrowVisitPlan[i].customerAddress != "" || this.report.tomorrowVisitPlan[i].visitMethod) {
                            if (this.report.tomorrowVisitPlan[i].customerName == "") {
                                alert("请填写客户名称！");
                                return false;
                            }
                            if (this.report.tomorrowVisitPlan[i].customerAddress == "") {
                                alert("请填写客户地点！");
                                return false;
                            }
                            if (!this.report.tomorrowVisitPlan[i].visitMethod) {
                                alert("请选择拜访方式！");
                                return false;
                            }
                        }
                    }
                }
                if (getUrlParamObj().roleName == "大客户经理") {
                    for (var i = 0; i < this.report.tomorrowVisitPlan.length; i++) {
                        if (this.report.tomorrowVisitPlan[i].customerName != "" || this.report.tomorrowVisitPlan[i].customerAddress != "" || this.report.tomorrowVisitPlan[i].lastVisitTime != "" || this.report.tomorrowVisitPlan[i].customerIndustry != "" || this.report.tomorrowVisitPlan[i].intentionDevice != "") {
                            if (this.report.tomorrowVisitPlan[i].customerName == "") {
                                alert("请填写客户名称！");
                                return false;
                            }
                            if (this.report.tomorrowVisitPlan[i].customerAddress == "") {
                                alert("请填写客户地点！");
                                return false;
                            }
                            if (this.report.tomorrowVisitPlan[i].customerIndustry == "") {
                                alert("请填写客户行业！");
                                return false;
                            }
                            if (this.report.tomorrowVisitPlan[i].intentionDevice == "") {
                                alert("请填写意向设备！");
                                return false;
                            }
                        }
                    }
                }

                var obj = {
                    dialog:'show'
                }
                prompt(JSON.stringify(obj))
                service.save(trimRN(this.report), function (r) {
                    if (!r.e.code) {
                        alert("保存成功");
                        var obj = {
                            dialog:'success'
                        }
                        prompt(JSON.stringify(obj))
                    } else {
                        alert(r.e.desc);
                    }
                });
            }
        },
        mounted: function () {

            var that = this;
            var obj = {
                dialog:'show'
            }
            prompt(JSON.stringify(obj))
            console.log(this.editable);
            $.ajax({
                url: server.ip + "/user/getUserViewById.json",
                contentType: 'application/json;charset=utf-8',
                type: "POST",
                data: JSON.stringify({id: getUrlParamObj().userId}),
                success: function (r) {
                    setCurrentUser(r)
                }
            }, true);
            this.currentUserTel = getUrlParamObj().tel;

            if (this.currentUserTel == '15034156981') {
                this.getAllTemplates();
            }
            //判断有没有传过来的id
            //判断页面状态
            service.getExpensesByParentId({parentId: 0, userId: getUrlParamObj().userId}, function (data) {
                that.costBigNameList = data;
            });
            if (getUrlParamObj().id) {
                this.pageType = 'browser';
                var data = {
                    id: getUrlParamObj().id
                }
                console.log(JSON.stringify(data))
                $.ajax({
                    url: server.ip + urlConfig.wreport.wreport.getById,
                    contentType: 'application/json;charset=utf-8',
                    type: "POST",
                    data: JSON.stringify(data),
                    success: function (r) {
                        var obj = {
                            dialog:'remove'
                        }
                        prompt(JSON.stringify(obj))
                        that.report = reportCountFixed(r.data.sendData);
                    },
                    error: function (e) {
                        var obj = {
                            dialog:'remove'
                        }
                        prompt(JSON.stringify(obj))
                        alert(e.responseText)
                    }
                });
            } else {
                $.ajax({
                    url: server.ip + "/user/getInferiorByParentId.json",
                    data: JSON.stringify({parentId: getUrlParamObj().userId}),
                    success: function (r) {
                        that.inferiorNameList = r;
                    }
                });
                var date = (new Date()).Format("yyyy-MM-dd");
                var dateYesterday = new Date();
                dateYesterday.addDays(-1);
                service.getByUserIdAndReportDate({
                    userId: getUrlParamObj().userId,
                    reportDate: getUrlParamObj().reportDate
                }, function (data) {
                    console.log(data);
                    this.pageType = "edit";
                    that.report.todayCostDetail = data.todayCostDetail;
                    if (data.main != null) {
                        $.ajax({
                            url: server.ip + "/wreport/getReceiverAndCopiersByUserIdAndReportDate.json",
                            data: JSON.stringify({
                                userId: getUrlParamObj().userId,
                                reportDate: dateYesterday.Format("yyyy-MM-dd")
                            }),
                            success: function (emailReceiver) {
                                var obj = {
                                    dialog:'remove'
                                }
                                prompt(JSON.stringify(obj))
                                console.log(emailReceiver)
                                console.log(emailReceiver.data.sendData.receivers);
                                data.receivers = emailReceiver.data.sendData.receivers;
                                console.log(emailReceiver.data.sendData.receivers);
                                data.copiers = emailReceiver.data.sendData.copiers;
                                that.report = reportCountFixed(data);
                                console.log(that.report);
                            }
                        });
                    } else {
                        that.report.main.userId = getUrlParamObj().userId;
                        that.report.todayCustomerVisit = data.todayCustomerVisit;
                        that.report.todayCustomerTelVisit = data.todayCustomerTelVisit;
                        that.report.todayVisitCustomer = data.todayVisitCustomer;
                        that.report.todayVisitCustomerBigRegion = data.todayVisitCustomerBigRegion;
                        if (getUrlParamObj().roleName == "大区经理") {
                            that.report.main.title = getUrlParamObj().reportDate + getUrlParamObj().roleName + '工作报告' + '(' + getUrlParamObj().name + '-大区)';
                        } else if (getUrlParamObj().roleName == "区域经理" || getUrlParamObj().roleName == "大客户经理") {
                            $.ajax({
                                url: server.ip + "/region/getRegionByWreport.json",
                                data: JSON.stringify({
                                    userId: getUrlParamObj().userId,
                                    roleName: getUrlParamObj().roleName
                                }),
                                success: function (r) {
                                    if (r.roleNames) {
                                        that.report.main.title = getUrlParamObj().reportDate + getUrlParamObj().roleName + '工作报告' + '(' + getUrlParamObj().name + '-' + r.roleNames + ')';
                                    } else {
                                        that.report.main.title = getUrlParamObj().reportDate + getUrlParamObj().roleName + '工作报告' + '(' + getUrlParamObj().name + ')';
                                    }
                                }
                            });
                        } else {
                            that.report.main.title = getUrlParamObj().reportDate + getUrlParamObj().roleName + '工作报告' + '(' + getUrlParamObj().name + ')';
                        }
                        that.report.main.reportDate = getUrlParamObj().reportDate;
                        that.report = reportCountFixed(that.report);
                        service.getModuleENamesByUserId({userId: getUrlParamObj().userId}, function (data) {
                            var eNames = [];
                            for (var i = 0; i < data.length; i++) {
                                eNames.push(data[i].eName);
                            }
                            that.report.main.moduleENames = eNames.join(',');
                        });
                        $.ajax({
                            url: server.ip + "/wreport/getReceiverAndCopiersByUserIdAndReportDate.json",
                            data: JSON.stringify({
                                userId: getUrlParamObj().userId,
                                reportDate: dateYesterday.Format("yyyy-MM-dd")
                            }),
                            success: function (emailReceiver) {
//
                             var obj = {
                                dialog:'remove'
                            }
                            prompt(JSON.stringify(obj))
                                that.report.receivers = emailReceiver.receivers;
                                that.report.copiers = emailReceiver.copiers;
                            },
                            error: function (e) {
                                var obj = {
                                    dialog:'remove'
                                }
                                prompt(JSON.stringify(obj))
                            }
                        });
                    }
//                    setTimeout(function () {
//                        $("#modal").hide();
//                    },500);

                    /*setTimeout(function () {
                     $(".table-report,.report-title,.div-btn").show();
                     },500);*/
                });
            }
        }
    });
    function renderLines(el, lineIndex) {

        $(".txtParent").eq(lineIndex).autoComplete({
            url: server.ip + "/weekPlan/getNameAndTel.json",
            render: function (r, panel) {
                for (var i = 0; i < r.length; i++) {
                    $("<li></li>").data("autoComplete",
                        r[i]).html("<a>" + r[i].customerName + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + r[i].customerTel + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (r) {
                app.report.tomorrowVisitPlan[app.currentfocus].customerName = r.customerName;
                app.report.tomorrowVisitPlan[app.currentfocus].customerAddress = r.customerAddress;
                app.report.tomorrowVisitPlan[app.currentfocus].lastVisitTime = r.lastVisitTime;
                app.report.tomorrowVisitPlan[app.currentfocus].customerIndustry = r.customerIndustry;
                app.report.tomorrowVisitPlan[app.currentfocus].intentionDevice = r.intentionDevice;
                return false;
            },
            extraParams: {createUserId: getUrlParamObj().userId},
            height: 210,
            width: 300
        });
    }
    Vue.directive('line-inserted', {
        inserted: function (el, binding) {
            console.log(el);
            var lineIndex = binding.value;
            renderLines(el, lineIndex);
        }
    });
    $(function () {
        $(".saveModle").show();
        $("#txtReceiver,#txtCopier").autoComplete({
            url: server.ip + urlConfig.system.user.getTop10ByNameUser,
            render: function (users, panel) {
                for (var i = 0; i < users.length; i++) {
                    $("<li></li>").data("autoComplete",
                        users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                var receiverIds = new Array();
                for (var i = 0; i < app.report.receivers.length; i++) {
                    receiverIds.push(app.report.receivers[i].userId);
                }
                for (var i = 0; i < app.report.copiers.length; i++) {
                    receiverIds.push(app.report.copiers[i].userId);
                }

                if ($.inArray(user.id, receiverIds) > -1) {
                    alert("收件人或抄送人重复");
                    $(this).val("");
                    return false;
                } else {
                    if (this.id == "txtReceiver") {
                        app.report.receivers.push({userId: user.id, userName: user.name});
                    } else {
                        app.report.copiers.push({userId: user.id, userName: user.name});
                    }
                    $(this).val("");
                    return false;
                }
            },
            height: 210,
            width: 320,
            top: 0,
            left: 0
        });
        $(".saveModle").hide();
    });


    //修正工作报告各个模块的默认行数
    function reportCountFixed(report) {
        for (var i = report.tomorrowVisitPlan.length; i < 1; i++) {
            report.tomorrowVisitPlan.push(new Template.TomorrowVisitPlan());
        }
        if (report.todayVisitCustomer == null || report.todayVisitCustomer.length == 0) {
            for (var i = report.todayVisitCustomer.length; i < 1; i++) {
                report.todayVisitCustomer.push(new Template.CustomerSalerVisit());
            }
        }
        if (report.todayVisitCustomerBigRegion == null || report.todayVisitCustomerBigRegion.length == 0) {
            for (var i = report.todayVisitCustomerBigRegion.length; i < 1; i++) {
                report.todayVisitCustomerBigRegion.push(new Template.CustomerSalerVisitRegion());
            }
        }
        for (var i = report.troubleShooting.length; i < 3; i++) {
            report.troubleShooting.push(new Template.Unfinish('1'));
        }
        for (var i = report.forSupportMatters.length; i < 2; i++) {
            report.forSupportMatters.push(new Template.Unfinish('2'));
        }
        for (var i = report.todayCustomerVisit.length; i < 1; i++) {
            report.todayCustomerVisit.push(new Template.CustomerSaler());
        }
        for (var i = report.todayCustomerTelVisit.length; i < 1; i++) {
            report.todayCustomerTelVisit.push(new Template.CustomerSalerTel());
        }
        for (var i = report.workOnTodayDescs.length; i < 1; i++) {
            report.workOnTodayDescs.push(new Template.WorkOnTodayDesc());
        }
        for (var i = report.unfinishes.length; i < 1; i++) {
            report.unfinishes.push(new Template.Unfinish('3'));
        }
        for (var i = report.todayCostDetail2.length; i < 1; i++) {
            report.todayCostDetail2.push(new Template.Cost());
        }
        for (var i = report.jobDescriptionForBranch.length; i < 5; i++) {
            report.jobDescriptionForBranch.push(new Template.Branch());
        }
        for (var i = report.todayGatherSituation.length; i < 1; i++) {
            report.todayGatherSituation.push(new Template.Gather());
        }
        return report;
    }
</script>
</body>
</html>